package com.abiao.shop.rabbitmq;

import com.abiao.shop.util.TurnUtil;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: SnapMQSender   秒杀消息发送类
 * @Author: AB
 * @Date: 2021-07-21
 * @Version:v1.0
 */
@Service
public class SnapMQSender {
    @Autowired
    AmqpTemplate amqpTemplate;

    //发送秒杀消息
    public void sendSnapMsg(SnapMessage message){
        amqpTemplate.convertAndSend(SnapMQConfig.SNAP_TOPIC_EXCHANGE,SnapMQConfig.SNAP_Key, TurnUtil.beanToString(message));
    }
}
